<form name="changeType"  method="post">
<table width="250" border="0" cellspacing="0" cellpadding="3" align="center">
<tr><td>&nbsp;</td></tr>
<tr><td><strong>Name</strong></td><td>:</td><td><? echo $ctx->detail['first_name'].' '.$ctx->detail['last_name'] ?></td>
                  </tr>
                     <?php if($ctx->presentType!=2) { ?>   <tr>
                          <td width="50" height="25" align="left" class="blue2"><strong>Type</strong></td>
                          <td width="5" align="left">:</td>
                          <td width="195" align="left"><select name="changeType"  id="changeType" class="selectbox_s" title="Please choose Type" tal:define="types types | string:us | presentType presentType">
            <option value="" tal:repeat="opt types" tal:attributes="value repeat/opt/key;selected php:repeat.opt.key == presentType" tal:content="opt"></option>
          </select><input type="hidden" name="userId" id="userId"  value="${userId}" /></td>
    </tr> 
    <tr><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td><input type="button" class="input_bt" value="Submit" onclick="javascript: saveType('${userId}');" /></td></tr>
     <?php } else { ?>     
    <tr><td width="17%" height="25" align="left" class="blue2"><strong>Type</strong></td>
                          <td width="1%" align="left">:</td>
                          <td>Admin</td></tr><?php } ?>              
                    </table>
                    </form>

<script type="text/javascript">
function saveType(userId)
{
	changeType = $('#changeType').val();
	//userId = $('#userId').val();
	//alert(userId);  return false;
		$.ajax({
		type: "POST",
		dataType: "json",
		url: "/admin-mvc/user/index/save-change?changeType="+changeType+"&userId="+userId,
		success: function(data){
		$("#flex1").flexReload();
		tb_remove();
		}
		});	
}
</script>